package util.AST.Comando;

import checker.SemanticException;
import checker.Visitor;
import util.AST.Expressao.ExpressaoAri;

public class Return extends ComandoSimples{
	
	private ExpressaoAri expressaoAri;
	
	public ExpressaoAri getExpressaoAri() {
		return expressaoAri;
	}

	public void setExpressaoAri(ExpressaoAri expressaoAri) {
		this.expressaoAri = expressaoAri;
	}

	public Return(ComandoSimples comandoSimples, DecFuncao decFunc) {
		super(comandoSimples, decFunc);
		// TODO Auto-generated constructor stub
	}
	
	public Return (ExpressaoAri expressaoAri){
		this.expressaoAri = expressaoAri;
	}
	
	@Override
	public String toString(int level) {
		int nextLevel = level+5;
		StringBuffer string = new StringBuffer();
		string.append("return\n");
		if(this.expressaoAri != null){
			string.append(super.getSpaces(nextLevel) + "|-" + this.expressaoAri.toString(nextLevel));
			
		}
		return string.toString();
		// TODO Auto-generated method stub
		
	}

	@Override
	public Object visit(Visitor v, Object o) throws SemanticException {
		return v.visitReturn(this, o);
	}
	
}
